﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataStruct
{
    public class CircleNode<T>
    {
        public Circle<T> Circle
        {
            get;
            internal set;
        }

        public CircleNode<T> Previous
        {
            get;
            internal set;
        }

        public CircleNode<T> Next
        {
            get;
            internal set;
        }

        public T Value
        {
            get;
            set;
        }

        public CircleNode()
        {
        }

        public CircleNode( T value )
        {
            this.Previous = this.Next = null;
            this.Value = value;
        }

        public CircleNode( Circle<T> circle, T value)
        {
            this.Previous = this.Next = null;
            this.Circle = circle;
            this.Value = value;
        }

        public CircleNode(CircleNode<T> previous, CircleNode<T> next, T value)
        {
            if (previous.Circle != next.Circle)
            {
                throw new Exception("CircleNode is not same Circle");
            }

            previous.Next = next.Previous = this;
            this.Circle = previous.Circle;
            Value = value;
        }
    }
}
